package com.meilai.project.controller.web.menu.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.meilai.project.controller.web.menu.dto.MenuListDTO;
import com.meilai.project.controller.web.menu.entity.MenuEntity;
import com.meilai.project.controller.web.menu.vo.MenuVO;
import com.meilai.project.entity.TreeSelect;
import com.meilai.project.vo.system.RouterVO;

import java.util.List;

public interface MenuService extends IService<MenuEntity> {

    List<MenuVO> getRoutersByUserId(Long userId);
    // 查询菜单
    List<MenuEntity> queryListByPid(Long pid);
    List<MenuEntity> listMenu(MenuListDTO dto);
    List<MenuEntity> listMenuByUserId(MenuListDTO dto, Long userId);
    List<MenuEntity> listMenuTreeByUserId(Long userId);
    List<MenuEntity> listMenuByRoleId(Long roleId);

    List<RouterVO> buildMenus(List<MenuEntity> menus);
    List<TreeSelect> buildMenuTree(List<MenuEntity> menus);

    MenuEntity getMenuById(Long menuId);
    /**
     * 新增菜单
     * @param menu
     * @return
     */
    int addMenu(MenuEntity menu);

    /**
     * 更新菜单
     * @param menu
     * @return
     */
    int updateMenu(MenuEntity menu);

    /**
     * 删除菜单
     * @param id
     * @return
     */
    boolean deleteMenu(Long id);
    /**
     * 检验菜单名称是否唯一
     * @param menu
     * @return
     */
    boolean checkMenuNameUnique(MenuEntity menu);

    boolean hasChildByMenuId(Long menuId);

    boolean checkMenuExistRole(Long menuId);
}
